package com.small.flowable.modules.modeler.services;

import com.common.basis.oauth.AuUser;
import com.common.basis.result.Result;
import org.flowable.ui.common.model.RemoteGroup;
import org.flowable.ui.common.model.RemoteToken;
import org.flowable.ui.common.model.RemoteUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 获取用户接口
 * @author wangguochao
 */
@FeignClient(value = "small-service-account")
public interface MyRemoteService {
    /**
     * 根据用户名查询用户
     *
     * @param username 用户名
     * @param password 密码
     * @return 用户
     */
    @GetMapping(value = "/small-service-account/flow-user/authenticateUser")
    RemoteUser authenticateUser(@RequestParam String username, @RequestParam String password);

    @GetMapping(value = "/small-service-account/flow-user/getToken")
    RemoteToken getToken(@RequestParam String tokenValue);

    @GetMapping(value = "/small-service-account/flow-user/getUser")
    RemoteUser getUser(@RequestParam String userId);

    /**
     * 根据用户名获取用户信息
     *
     * @param filter 用户名
     * @return 用户列表
     */
    @GetMapping(value = "/small-service-account/flow-user/findUsersByNameFilter")
    List<RemoteUser> findUsersByNameFilter(@RequestParam String filter);

    @GetMapping(value = "/small-service-account/flow-user/findUsersByGroup")
    List<RemoteUser> findUsersByGroup(@RequestParam String groupId);

    @GetMapping(value = "/small-service-account/flow-user/getGroup")
    RemoteGroup getGroup(@RequestParam String groupId);

    @GetMapping(value = "/small-service-account/au-user/findGroupsByNameFilter")
    List<RemoteGroup> findGroupsByNameFilter(@RequestParam String filter);
    /**
     * 根据ID查询用户
     */
    @GetMapping("/small-service-account/au-user/findByIds")
    public Result<List<AuUser>> findByIds(@RequestParam List<String> ids);
}
